package com.zsc.shixun.controller;

import com.zsc.shixun.service.IArticleService;
import com.zsc.shixun.utils.LoginMessageUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * markdown编辑器
 * </p>
 *
 * @author ZWYZY
 * @since 2020/6/7
 */
@Controller
@RequestMapping("/editor")
public class EditorController {
    private static final Logger logger = LoggerFactory.getLogger(EditorController.class);

    @Autowired
    private LoginMessageUtils loginMessageUtils;
    @Autowired
    private IArticleService articleService;

    @RequestMapping("/index")
    public String index(HttpServletRequest request, @RequestParam(required = false) Long id) {
        if (id != null) {
            request.setAttribute("article", articleService.getById(id));
        }
        return "admin/editor/index";
    }


}
